package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.autocode.ZlTableSequence;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceAddDTO;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceDelDTO;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceEditDTO;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceQueryDTO;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceDetailDTO;
import com.my.zl.console.dto.autocode.tableSequence.ReqTableSequenceStateDTO;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceAddDTO;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceDelDTO;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceEditDTO;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceQueryDTO;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceDetailDTO;
import com.my.zl.console.service.autocode.ITableSequenceService;
import com.my.zl.console.dto.autocode.tableSequence.ResTableSequenceStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 数据库表自增序号
 * @author ZL
 */
@Api(value="数据库表自增序号",tags ="数据库表自增序号")
@RestController
@RequestMapping("/api/autocode/tableSequence")
public class TableSequenceController extends BaseController {

    @Autowired
    private ITableSequenceService tableSequenceService;
    
    /**
     * 查询
     */
    @ApiOperation(value="数据库表自增序号-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResTableSequenceQueryDTO> listTableSequence(ReqTableSequenceQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResTableSequenceQueryDTO data = tableSequenceService.queryTableSequenceList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="数据库表自增序号-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResTableSequenceDetailDTO> detailTableSequence(ReqTableSequenceDetailDTO reqInfo) throws Exception{
        ResTableSequenceDetailDTO data = tableSequenceService.queryTableSequenceDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="数据库表自增序号-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResTableSequenceAddDTO> addTableSequence(@RequestBody ReqDTO<ReqTableSequenceAddDTO> reqInfo) throws Exception{
        ResTableSequenceAddDTO data = tableSequenceService.insertTableSequenceInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="数据库表自增序号-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResTableSequenceEditDTO> editTableSequence(@RequestBody ReqDTO<ReqTableSequenceEditDTO> reqInfo) throws Exception{
        ResTableSequenceEditDTO data = tableSequenceService.updateTableSequenceInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="数据库表自增序号-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResTableSequenceDelDTO> delTableSequence(@RequestBody ReqDTO<ReqTableSequenceDelDTO> reqInfo) throws Exception{
        ResTableSequenceDelDTO data = tableSequenceService.deleteTableSequenceInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="数据库表自增序号-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResTableSequenceStateDTO> stateTableSequence(@RequestBody ReqDTO<ReqTableSequenceStateDTO> reqInfo) throws Exception{
        ResTableSequenceStateDTO data = tableSequenceService.updateTableSequenceState(reqInfo);
        return successDATA(data); 
    }
    
    
}